import type { Advertise, AdvertisePageDto } from '@/models/advertise'
import type { CommonResult, CommonPage } from '@/models/request'
import request, { ContentTypeEnum } from '@/utils/request'
export function fetchList(params: AdvertisePageDto) {
  return request<CommonPage<Advertise>>({
    url: '/home/advertise/list',
    method: 'get',
    params: params,
  })
}
export function updateStatus(id: number, params: { status: 0 | 1 }) {
  return request<CommonResult>({
    url: '/home/advertise/update/status/' + id,
    method: 'post',
    params: params,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}
export function deleteHomeAdvertise(data: { ids: string }) {
  return request<CommonResult>({
    url: '/home/advertise/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}
export function createHomeAdvertise(data: Advertise) {
  return request<CommonResult>({
    url: '/home/advertise/create',
    method: 'post',
    data: data,
  })
}
export function getHomeAdvertise(id: number) {
  return request<CommonResult<Advertise>>({
    url: '/home/advertise/' + id,
    method: 'get',
  })
}

export function updateHomeAdvertise(id: number, data: Advertise) {
  return request<CommonResult>({
    url: '/home/advertise/update/' + id,
    method: 'post',
    data: data,
  })
}
